package edu.tms.crud;

import java.util.*;
import java.io.*;

public class PropertyReader {
	static private Properties ps;// 属性集合，类似MAP,可以读取配置文件

	static {
		ps = new Properties();
		try {
			InputStream in = PropertyReader.class
					.getResourceAsStream("/config.properties");//读取PropertyReader类所在文件夹中的文件
			ps.load(in);
			in.close();
		} catch (Exception e) {
			Logger.log(Logger.ERROR, "配置文件读取错误:"+e.getMessage());
		}
	}

	public static String get(String key) {
		String r=(String) ps.get(key);//按KEY读取值
		if(r==null)Logger.log(Logger.ERROR, "配置属性名错误:"+key);
		return r;
	}
}
